-
Notifications
You must be signed in to change notification settings - Fork 911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy binding for D3D11 #4699
Merged
Merged
Lazy binding for D3D11 #4699
+914
−226
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7998c02
to
06e8f50
Compare
06e8f50
to
63900e8
Compare
126798b
to
02d0894
Compare
We're going to have to do this at runtime, so this needs to be fast.
No functional change, just makes it less annoying to use in methods that can be called from both immediate and deferred contexts-
We won't do lazy bindings for UAVs, but at least bring this function in line with the rest of the binding functions.
This was only needed because Bind* methods were also templated.
And factor UAV counter updates out of binding.
02d0894
to
b8d7918
Compare
Moderately cursed because PS UAVs are also available to other graphics stages.
Some games will unconditionally use a high index for UAVStartSlot.
b8d7918
to
5490c64
Compare
Repository owner
deleted a comment from
DanielPopRe
Feb 20, 2025
Repository owner
deleted a comment from
Blisto91
Feb 20, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on #4693 because the DXBC bits would otherwise turn into rebase hell, so that needs to land first.Merged.TL;DR is that we defer forwarding resource bindings (
SetShaderResourceViews
and friends) to the backend if:These will instead be applied on the next draw or dispatch that are actually known to use the given binding.
The rationale here is that forwarding unused bindings can confuse the backend a little and lead to descriptor set invalidations even if none of the actually used bindings have changed. As for null bindings, these are very rarely actually used in shaders, and instead we can assume that the app will either bind a non-null resource right after or binds a shader which doesn't use the given binding slot.
At the same time, immediately forwarding currently active binding avoids the extra overhead from tracking everything in well-behaved applications, even if this means that some bindings might be redundant (e.g. app binds a shader that doesn't use it right after, or binds two different resources to the same slot back-to-back).
In practice, this improves CPU-bound performance in God of War somewhat, and in Trine 5 this reduces the number of draw calls by ~50% in the menu because our indirect draw batching can now kick in properly. Almost all games run into this in some capacity, so it should be a nice overall improvement.